home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gtlayout / source / lt_refresh.c < prev    next >
C/C++ Source or Header  |  1999-04-19  |  5KB  |  207 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1998 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #include "Assert.h"
  15.  
  16. /****** gtlayout.library/LT_BeginRefresh ******************************************
  17. *
  18. *   NAME
  19. *    LT_BeginRefresh -- Optimized window refreshing
  20. *
  21. *   SYNOPSIS
  22. *    LT_BeginRefresh(Handle)
  23. *                      A0
  24. *
  25. *   FUNCTION
  26. *    If you wish to handle window refreshing all on your own, you
  27. *    might want to use the LT_BeginRefresh...LT_EndRefresh pair
  28. *    in your program. By default the user interface layout engine
  29. *    will automatically intercept IDCMP_REFRESHWINDOW events and
  30. *    react to them accordingly.
  31. *
  32. *   INPUTS
  33. *    Handle - Pointer to a LayoutHandle structure.
  34. *
  35. *   RESULT
  36. *    none
  37. *
  38. *   SEE ALSO
  39. *    intuition.library/BeginRefresh
  40. *    intuition.library/EndRefresh
  41. *    gtlayout.library/LT_EndRefresh
  42. *
  43. ******************************************************************************
  44. *
  45. */
  46.  
  47. VOID LIBENT
  48. LT_BeginRefresh(REG(a0) LayoutHandle *handle)
  49. {
  50.     if(handle)
  51.     {
  52.         GT_BeginRefresh(handle->Window);
  53.  
  54.         LTP_DrawGroup(handle,handle->TopGroup);
  55.     }
  56. }
  57.  
  58.  
  59. /*****************************************************************************/
  60.  
  61.  
  62. /****** gtlayout.library/LT_EndRefresh ******************************************
  63. *
  64. *   NAME
  65. *    LT_EndRefresh -- Optimized window refreshing
  66. *
  67. *   SYNOPSIS
  68. *    LT_EndRefresh(Handle)
  69. *                    A0
  70. *
  71. *    VOID LT_EndRefresh(LayoutHandle *);
  72. *
  73. *   FUNCTION
  74. *    If you wish to handle window refreshing all on your own, you
  75. *    might want to use the LT_BeginRefresh...LT_EndRefresh pair
  76. *    in your program. By default the user interface layout engine
  77. *    will automatically intercept IDCMP_REFRESHWINDOW events and
  78. *    react to them accordingly.
  79. *
  80. *   INPUTS
  81. *    Handle - Pointer to a LayoutHandle structure.
  82. *
  83. *   RESULT
  84. *    none
  85. *
  86. *   SEE ALSO
  87. *    gtlayout.library/LT_BeginRefresh
  88. *    intuition.library/BeginRefresh
  89. *    intuition.library/EndRefresh
  90. *
  91. ******************************************************************************
  92. *
  93. */
  94.  
  95. VOID LIBENT
  96. LT_EndRefresh(REG(a0) LayoutHandle *handle,REG(d0) BOOL complete)
  97. {
  98.     if(handle)
  99.         GT_EndRefresh(handle->Window,complete);
  100. }
  101.  
  102. /****** gtlayout.library/LT_Refresh *****************************************
  103. *
  104. *   NAME
  105. *    LT_Refresh -- Redraws the entire window contents.
  106. *
  107. *   SYNOPSIS
  108. *    LT_Refresh(Handle)
  109. *                 A0
  110. *
  111. *    VOID LT_Refresh(LayoutHandle *);
  112. *
  113. *   FUNCTION
  114. *    Redraws the contents of the window, this includes both gadgets
  115. *    and imagery.
  116. *
  117. *   INPUTS
  118. *    Handle - Pointer to a LayoutHandle structure.
  119. *
  120. *   RESULT
  121. *    none
  122. *
  123. *   SEE ALSO
  124. *       gadtools.library/GT_RefreshWindow
  125. *       intuition.library/RefreshGList
  126. *
  127. ******************************************************************************
  128. *
  129. */
  130.  
  131. VOID LIBENT
  132. LT_Refresh(REG(a0) LayoutHandle *handle)
  133. {
  134.     if(handle)
  135.     {
  136.         #ifdef DO_BOOPSI_KIND
  137.         {
  138.             if(handle->BOOPSIList)
  139.                 RefreshGList((struct Gadget *)handle->BOOPSIList,handle->Window,NULL,(UWORD)-1);
  140.         }
  141.         #endif    /* DO_BOOPSI_KIND */
  142.  
  143.         RefreshGList(handle->List,handle->Window,NULL,(UWORD)-1);
  144.  
  145.         GT_RefreshWindow(handle -> Window,NULL);
  146.  
  147.         LTP_DrawGroup(handle,handle -> TopGroup);
  148.     }
  149. }
  150.  
  151. /****** gtlayout.library/LT_CatchUpRefresh **************************************
  152. *
  153. *   NAME
  154. *    LT_CatchUpRefresh -- Repair the display after missing the
  155. *                         Window refresh message (V34).
  156. *
  157. *   SYNOPSIS
  158. *    LT_CatchUpRefresh(Handle)
  159. *                        A0
  160. *
  161. *    VOID LT_CatchUpRefresh(LayoutHandle *);
  162. *
  163. *   FUNCTION
  164. *    In case an application missed an IDCMP_REFRESHWINDOW event
  165. *    the display may be damaged and in need of repair. This can
  166. *    happen if the ASL requester is attached to the window,
  167. *    sharing its IDCMP with the window. Any refresh events will then
  168. *    go straight to nil. Call this routine if you believe that
  169. *    you missed a refresh event. The display will be repaired only
  170. *    if it is in need of repair, so there is no harm in calling it
  171. *    if not actually necessary.
  172. *
  173. *   INPUTS
  174. *    Handle - Pointer to a LayoutHandle structure.
  175. *
  176. *   RESULT
  177. *    none
  178. *
  179. *   SEE ALSO
  180. *    gtlayout.library/LT_BeginRefresh
  181. *    intuition.library/BeginRefresh
  182. *    intuition.library/EndRefresh
  183. *
  184. ******************************************************************************
  185. *
  186. */
  187.  
  188. VOID LIBENT
  189. LT_CatchUpRefresh(REG(a0) LayoutHandle *handle)
  190. {
  191.     if(handle)
  192.     {
  193.             /* Do we have damage? */
  194.  
  195.         if(handle->Window->WLayer->Flags & LAYERREFRESH)
  196.         {
  197.                 /* Do the usual bit. */
  198.  
  199.             GT_BeginRefresh(handle->Window);
  200.  
  201.             LTP_DrawGroup(handle,handle->TopGroup);
  202.  
  203.             GT_EndRefresh(handle->Window,TRUE);
  204.         }
  205.     }
  206. }
  207.